package com.example.juyixia;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Fragment;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class Chat_Fragment extends Fragment {
	private View view;
	private ListView messagelist;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		view = inflater.inflate(R.layout.fragment_01, container, false);
		messagelist = (ListView)view.findViewById(R.id.messagelist);
		  List<Map<String, Object>> list=getData();
	        //适配器，刚刚重写的！
	        MessageAdapter mAdapter = new MessageAdapter(getActivity(), list);
	        //设置适配器
	        messagelist.setAdapter(mAdapter);
		return view;
	}
	 public List<Map<String, Object>> getData() {

	        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
	       
	        	Map<String, Object> map = new HashMap<String, Object>();
	        	map.put("image",  R.drawable.default_useravatar);
	        	map.put("username", "尚甲");
	        	map.put("messcontent", "接受请求");
	        	map.put("rectime", "2017.6.6");
	        	 list.add(map);
			
	      
	        return list;
	    }
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
		
	}
}
